# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=sugar
pkgver=0.119
pkgrel=2
pkgdesc="Sugar GTK shell"
arch=('any')
url="https://sugarlabs.org/"
license=('GPL')
depends=('gnome-keyring' 'gst-plugins-espeak' 'gtksourceview3' 'gvfs' 'libwnck3'
         'libxklavier' 'metacity' 'mobile-broadband-provider-info' 'openssh' 'python-gwebsockets'
         'sugar-toolkit-gtk3' 'telepathy-gabble' 'telepathy-salut' 'upower' 'webkit2gtk'
         'xdg-user-dirs')
makedepends=('intltool' 'python-empy')
source=(https://download.sugarlabs.org/sources/sucrose/glucose/$pkgname/$pkgname-$pkgver.tar.xz
        dont-overwrite-settings.patch)
sha256sums=('b9c00c0a8b5ddd7ebfcd590ad0fc85352f2159cf509f7649e164995689d67619'
            'a426e295f8810c5b6b1a136338b630c67c5b98c7ca368a261e0390e42b6d1465')

prepare() {
  cd $pkgname-$pkgver

  # Use correct D-Bus config location
  sed -i '/^nmservicedir =/ s/sysconfdir/datadir/' data/Makefile.{am,in}

  # Don't overwrite default GNOME settings
  patch -Np1 -i ../dont-overwrite-settings.patch
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --sysconfdir=/etc \
              --disable-schemas-compile \
              EMPY=`echo /usr/lib/python3.*/site-packages/em.py`
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  rm -r "$pkgdir"/usr/share/sugar/extensions/cpsection/updater/
}
